package com.ruoyi.project.system.recommend.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.recommend.mapper.RecommendMapper;
import com.ruoyi.project.system.recommend.domain.Recommend;
import com.ruoyi.project.system.recommend.service.IRecommendService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 推荐Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-05-27
 */
@Service
public class RecommendServiceImpl implements IRecommendService 
{
    @Autowired
    private RecommendMapper recommendMapper;

    /**
     * 查询推荐
     * 
     * @param id 推荐ID
     * @return 推荐
     */
    @Override
    public Recommend selectRecommendById(Long id)
    {
        return recommendMapper.selectRecommendById(id);
    }

    /**
     * 查询推荐列表
     * 
     * @param recommend 推荐
     * @return 推荐
     */
    @Override
    public List<Recommend> selectRecommendList(Recommend recommend)
    {
        return recommendMapper.selectRecommendList(recommend);
    }

    /**
     * 新增推荐
     * 
     * @param recommend 推荐
     * @return 结果
     */
    @Override
    public int insertRecommend(Recommend recommend)
    {
        recommend.setCreateTime(DateUtils.getNowDate());
        return recommendMapper.insertRecommend(recommend);
    }

    /**
     * 修改推荐
     * 
     * @param recommend 推荐
     * @return 结果
     */
    @Override
    public int updateRecommend(Recommend recommend)
    {
        recommend.setUpdateTime(DateUtils.getNowDate());
        return recommendMapper.updateRecommend(recommend);
    }

    /**
     * 删除推荐对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteRecommendByIds(String ids)
    {
        return recommendMapper.deleteRecommendByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除推荐信息
     * 
     * @param id 推荐ID
     * @return 结果
     */
    @Override
    public int deleteRecommendById(Long id)
    {
        return recommendMapper.deleteRecommendById(id);
    }
}
